[#import "/framework/JGP.htm"  as JGP]
<!--
项目   jgp-cloud-parent
作者   LOUFEI [Gavin]
时间   2019-11-03
-->
[@JGP.head "编辑系统用户"/]
[@JGP.body]
    <jgp-div _row="['30','*']" _runit="px">
        <div slot="1-1">
            <jgp-btn _form="form" _fn="saveCallback">保存</jgp-btn>
        </div>
        <jgp-form slot="2-1" _id="form" _action="/security/user-api-ctl/save-system-user">
            <jgp-form-group _title="用户基本信息">
                <jgp-text _label="姓名" _name="realName" _value="" _col="12" _required="true"></jgp-text>
                <jgp-text _label="用户名" _name="username" _value="" _col="12" _required="true"></jgp-text>
                <jgp-text _label="手机号" _name="tel" _value="" _col="12"_required="true"></jgp-text>
                <jgp-text _label="邮箱" _name="email" _value="" _col="12"_required="true"></jgp-text>
            </jgp-form-group>
        </jgp-form>
    </jgp-div>
[/@JGP.body]

[@JGP.foot]
    <script>
        var id = ${id!'null'};

        JGP.$onload(function () {
            initItem();
        })

        function initItem() {
            var form = JGP.form('form');
            if (id) {
                JGP.$post('/security/user-api-ctl/query-system-user-one', {id: id}, function (res) {
                    form.setData(res.data.user)
                })
            }
        }

        function saveCallback(result) {
            if (result.back.flag) {
                JGP.$alert('创建成功')
                JGP.$close(true);
            }
        }


    </script>
[/@JGP.foot]